﻿<%if not in_sdcms then response.write("template load fail"):response.end() end if%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="{sdcms[seokey]}" />
<meta name="Description" content="{sdcms[seodesc]}" />
<title>{sdcms[webname]} - powered by sdcms</title>
<link href="{webroot}lib/css/base.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/public.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_base.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_bind.css" rel="stylesheet" type="text/css" />
<script>var webroot="{webroot}";</script>
<script src="{webroot}lib/js/jquery.js"></script>
<script src="{webroot}lib/js/jquery-migrate-1.1.0.min.js"></script>
<script src="{webroot}lib/tips/jquery.tips.js"></script>
<script src="{webroot}lib/js/base.js"></script>
<script src="{webroot}lib/js/mobile.js"></script>
<script src="{webroot}lib/validator/jquery.validator.js"></script>
<script src="{webroot}lib/validator/zh_CN.js"></script>
<script src="{webroot}theme/default/js/sdcms.js"></script>
<script src="{webroot}lib/dialog/artdialog.js"></script>
{dim userdata:userdata=sdcms.userinfo}
<script>
$(function(){
	var rate={sdcms.getnum(userdata(11))};
	var monthprice={sdcms[str_monthprice]};
	var yearprice={sdcms[str_yearprice]};
	$("#t1_0").click(function(){$("#paymonth").css("display","block");$("#payyear").css("display","none");$("input[name=t2]:eq(0)").attr("checked",'checked');setresult(monthprice,rate);});
	$("#t1_1").click(function(){$("#paymonth").css("display","none");$("#payyear").css("display","block");$("input[name=t3]:eq(0)").attr("checked",'checked');setresult(yearprice,rate);});
	$("input[name='t2']").click(function(){setresult($(this).attr("value")*monthprice,rate);});
	$("input[name='t3']").click(function(){setresult($(this).attr("value")*yearprice,rate);});
	$("#t4").val(monthprice*rate);
	$("#paytotal").html(monthprice*rate);
	var mp=monthprice-(monthprice*rate);
	if(mp!=0){$("#minpay").html("省<span> "+mp+" </span>元")}
	
	$(".form_upgrade").validator(
	{
		stopOnError:true,
		theme:'yellow_right_effect',
		ignore:':hidden',
		valid:function(form)
		{
			if(parseFloat($("#t0").val())<parseFloat($("#t4").val()))
			{
				dialog({title:"\u5347\u7ea7\u002f\u7eed\u8d39\u0056\u0049\u0050\u4f1a\u5458",content:"\u60a8\u7684\u4f59\u989d\u4e0d\u8db3\uff0c\u8bf7\u5148\u5145\u503c\uff01",button:[{value:'\u7acb\u523b\u5145\u503c',callback:function(){location.href='pay.asp'},autofocus:true}],cancel:true}).showModal();
				return false
			}
			dialog({
			title:"\u652f\u4ed8\u63d0\u793a",
			content:"\u786e\u5b9a\u8981\u4ed8\u6b3e"+$("#t4").val()+"\u5143\uff1f",
			ok:function()
			{
				$.ajax(
				{
					url:"?act=db",
					type:"post",
					data:$(form).serialize(),
					success:function(data){
						data=jQuery.parseJSON(data);
						var type="warn";
						if(data.status=="y"){type="ok";}
						$.fn.tips({type:type,content:data.info});
						if(data.status=="y")
						{
							setTimeout("location.href='?'",1000);
						}
					}
				});
			},
			cancel:true
			}).showModal();
		}
	});
	
});
function setresult(t0,t1)
{
	var mustpay;
	var minpay;
	mustpay=t0*t1;
	minpay=t0-mustpay;
	$("#t4").val(mustpay);
	$("#paytotal").html(mustpay);
	if(minpay!=0){$("#minpay").html("省<span> "+minpay+" </span>元");}
}
</script>
</head>
<body>
    {sdcms:include("../sdcms_head.asp")}
    
    <div id="position">您所在的位置：<a href="{webroot}">首页</a> > <a href="./">会员中心</a></div>
    <div class="w980 mt10 mc">
        {sdcms:include("sdcms_menu.asp")}
        <div class="right_big">
            <div class="b">
                <div class="subject">升级/续费VIP会员</div>
                <div class="p35">
                
                <form class="form_upgrade" method="post">
                <ul id="onlinepay">
                    {dim thisnow:thisnow=clng(sdcms.getdate(now(),"",1))}
                    {sdcms:rs field="amount,isvip,overdate" table="sd_user" where="id=[userdata(0)]"}
                    {if $rs[isvip]=1}<li><span>您是VIP会员</span> ({if $rs[overdate]>=thisnow}到期时间为：{sdcms.numtodate($rs[overdate])}{else}<span>过期</span>{/if})</li>{/if}
                    <li>账户余额：<span><input type="hidden" name="t0" id="t0" class="ip" maxlength="10" value="{$rs[amount]}" />{sdcms.getnum($rs[amount])}</span> 元</li>
                    {/sdcms:rs}
                    
                    <li>付款方式：<input type="radio" name="t1" id="t1_0" value="0" checked="checked" /><label for="t1_0">按月</label>
                    <input type="radio" name="t1" id="t1_1" value="1" /><label for="t1_1">按年</label></li>
                    <li id="paymonth">开通时长：<input type="radio" name="t2" id="t2_1" value="1" checked="checked" /><label for="t2_1">1个月</label>
                    <input type="radio" name="t2" id="t2_3" value="3" /><label for="t2_3">3个月</label>
                    <input type="radio" name="t2" id="t2_6" value="6" /><label for="t2_6">6个月</label>
                    <input type="radio" name="t2" id="t2_9" value="9" /><label for="t2_9">9个月</label></li>
                    <li id="payyear" class="dis">开通时长：<input type="radio" name="t3" id="t3_1" value="1" checked="checked" /><label for="t3_1">1年</label>
                    <input type="radio" name="t3" id="t3_2" value="2" /><label for="t3_2">2年</label>
                    <input type="radio" name="t3" id="t3_3" value="3" /><label for="t3_3">3年</label>
                    <input type="radio" name="t3" id="t3_5" value="5" /><label for="t3_5">5年</label></li>
                    <li>付款金额：<input type="hidden" name="t4" id="t4" class="ip" maxlength="10" /> <span id="paytotal"></span> 元　<u id="minpay"></u>　</li>
                    <li>登录密码：<input type="password" name="t5" class="ip" maxlength="20" data-rule="登录密码:required;password;" /></li>
                    <dd><input type="submit" value="下一步" class="bnt_blue" /> <input type="button" value="取消" onclick="location.href='javascript:history.go(-1)'" class="bnt_blue" /></dd>
                </ul>
                </form>
                
                </div>
            </div>
        </div>
    </div>
    {sdcms:include("../sdcms_foot.asp")}